Lab 11: Recursion
Summary
As usual, we'll work on this week's B notebook today. There are then 3 different options for Thonny activities to try: strings, turtles, and music.
Lab Setup
- Find your partner
- Download lab11_recursion.zip which includes the starter code for non-exercise parts of the lab
- Extract that zip file and move the resulting
lab11_recursion
folder into yourcs111
directory on your desktop. - Open Thonny and view the
lab11_recursion
files
Table of Contents
- Lab 11 Home
- Part 1: Exercises (start with B notebook)
- Part 2A: Recursive Turtles (work on this part OR the next one)
- Part 2B: Recursive Drums (work on this part OR the previous one)
- Reference: Case-by-case recursion strategy
- Reference: Recursive design patterns
- Knowledge Check
Big Questions
- How has your understanding of loops and repetitive actions changed since you started this class?
Show "Answer"
There's no right answer here, but we hope that you feel you have a more refined and explicit understanding of how repetitive processes start and stop, and what kinds of patterns they might exhibit. It may not be obvious (which is why we're asking this question), but by thinking a lot about loops, and where they should start and stop, what should happen in each iteration, etc., you are developing a new way to think about certain problems. And we're about to do that again with recursion. - What is "wishful thinking?"
Show Answer
Wishful thinking is when you assume that you have already solved a problem before starting to solve it. It's a process of willing suspension of disbelief, just like when you get absorbed in a good story and are willing to excuse inaccuracies or exaggerations for the sake of the plot (except maybe a little less entertaining and a little more deliberate). If used carefully and with precision, it can be helpful in solving recursive problems.